import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.ImageIcon;

public class Manager extends JFrame implements ActionListener{

    private Toolkit toolkit;
   //static int i = 0;
    JLabel layout;
    JButton logout =new JButton("Log Out");
    JButton clean =new JButton("Mark Clean");
    JButton[] t = new JButton[5];
    login logger;
    int st=0;
    OrderManagement orders;
    SeatingManagement seats;
    LogInOut loggerinout;
    
    public Manager()
    {
    	;
    }
    
    public Manager(login log, OrderManagement orderi, SeatingManagement seatsi, LogInOut logi) {
    	setTitle("Restaurant Master 2.0 - Manager");
        setSize(800, 600);
        
        orders=orderi;
        seats=seatsi;
        logger=log;
        toolkit = getToolkit();
        loggerinout = logi;
        
        Dimension size = toolkit.getScreenSize();
        setLocation((size.width - getWidth())/2, (size.height - getHeight())/2);
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

        JPanel panel = new JPanel();
        getContentPane().add(panel);
        panel.setLayout(null);

		logout.addActionListener(this);
		logout.setBounds(25,525,100,30);
		panel.add(logout);
		
		t[0]=new JButton("Sales Statistics");
		t[1]=new JButton("Table Layout");
		t[2]=new JButton("Restaurant Menu");
		t[3]=new JButton("Employee Schedule");
		t[4]=new JButton("Employee Information");
		
		t[0].setBounds(300,25,175,75);
		t[1].setBounds(300,125,175,75);
		t[2].setBounds(300,225,175,75);
		t[3].setBounds(300,325,175,75);
		t[4].setBounds(300,425,175,75);
		
		for(int i=0;i<5;i++)
		{
			t[i].addActionListener(this);
		}
		
		
		for(int i=0;i<5;i++)
		{
			panel.add(t[i]);
		}
		
		
		
    }
    
    //event handler
    

    
    public void actionPerformed(ActionEvent event)
    {
    	Object source = event.getSource();
    	refresh();
    	
    	if (source == logout)
    	{
    		logger.setuid(null);
    		setVisible(false);
    	}
    	
    	if (source == t[0])
    	{
    		//list orders
    	}
    	
    	if (source == t[1])
    	{
    		//display table status
    		
    	}
    	
    	
    	if (source == t[2])
    	{
    		//display menu
    		showmenu(0, orders, 0);
    	}
    	
    	if (source == t[3])
    	{
    		//display employee schedule
    	}
    	
    	if (source == t[4])
    	{
    		//display employee information
    		showemployees();
    	}
    	
    	
    	
    }
    
    public void refresh()
    {
    	
	}
    
    public void showmenu(int i, OrderManagement orderi, int ordnum)
    {
    	Menu menu=new Menu(i, orderi, ordnum);
    	menu.setVisible(true);
    }
    
    public void showemployees()
    {
    	Emps emp=new Emps(loggerinout);
    	emp.setVisible(true);
    }
    
}

    
